package cn.fay.chapter15;

public class EpicBattle {
	static <POWER extends SuperHearing> void useSuperHearing(SuperHero<POWER> hero){
		hero.getPower().hearSubtleNoises();
	}
	static <POWER extends SuperHearing&SuperSmell> void superFind(SuperHero<POWER> hero){
		hero.getPower().hearSubtleNoises();
		hero.getPower().traceBySmell();
	}
	public static void main(String[] args) {
		DogBoy dogBoy=new DogBoy();
		useSuperHearing(dogBoy);
		superFind(dogBoy);
	}

}
interface SuperPower{}
interface XRayVision extends SuperPower{
	void seeThroughWall();
}
interface SuperHearing extends SuperPower{
	void hearSubtleNoises();
}
interface SuperSmell extends SuperPower{
	void traceBySmell();
}
class SuperHero<POWER extends SuperPower>{
	POWER power;
	SuperHero(POWER power){
		this.power=power;
	}
	public POWER getPower() {
		return power;
	}
}
class SuperSleuth<POWER extends XRayVision> extends SuperHero<POWER>{
	public SuperSleuth(POWER power) {
		super(power);
	}
	void see(){
		power.seeThroughWall();
	}
}
class CanineHero<POWER extends SuperHearing&SuperSmell> extends SuperHero<POWER>{

	CanineHero(POWER power) {
		super(power);
	}
	void hear(){ power.hearSubtleNoises();}
	void smell(){ power.traceBySmell();}
}
class SuperHearSmell implements SuperHearing,SuperSmell{
	public void traceBySmell() {}
	public void hearSubtleNoises() {}
}
class DogBoy extends CanineHero<SuperHearSmell>{
	DogBoy() {
		super(new SuperHearSmell());
	}
}
